package br.unip.tcc.domotic.orm;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "tipo_sensor")
public class SensorType extends AbstractORM {
	
	private static final long serialVersionUID = 1L;
	
	private Integer sensorTypeId;
	private String sensorTypeDescription;
	private Set<Sensor> sensors = new HashSet<Sensor>(0);
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "cod_tipo_sensor", unique = true, nullable = false)
	public Integer getSensorTypeId() {
		return sensorTypeId;
	}
	
	public void setSensorTypeId(Integer sensorTypeId) {
		this.sensorTypeId = sensorTypeId;
	}
	
	@Column(name = "des_tipo_sensor", nullable = false)
	public String getSensorTypeDescription() {
		return sensorTypeDescription;
	}
	
	public void setSensorTypeDescription(String sensorTypeDescription) {
		this.sensorTypeDescription = sensorTypeDescription;
	}
	
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "sensorType")
	public Set<Sensor> getSensors() {
		return sensors;
	}
	
	public void setSensors(Set<Sensor> sensors) {
		this.sensors = sensors;
	}
	
}
